home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
U-Utilities
/
(c)u1.d64
/
dissambler.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
4KB
|
124 lines
5 POKE53280,1:POKE53281,1:POKE53272,21:REM C64 MODS 1983
6 POKE1011,173:POKE1014,141
7 POKE1015,242:POKE1016,3:POKE1017,96
8 DEF FNA(W)=(FNB(WAND127)-32AND63)+32
9 DEF FNB(W)=(32+W)/2+ABS(32-W)/2
40 PRINT"[144][147] 6502 DISASSEMBLER ":PRINT
50 INPUT"TAPE FILE OUTPUT (Y OR N) ";FO$
55 IFFO$<>"Y"ANDFO$<>"N"THEN50
56 INPUT"PRINTER OUTPUT (Y OR N) ";PO$
57 IFPO$<>"Y"THEN100
58 PRINT"TURN ON PRINTER, HIT ANY KEY"
59 GETA$:IFA$=""GOTO59
60 OPEN5,5
100 DIM NM$(56),OP%(255),NB(13):NM$(0)="???":H$="0123456789ABCDEF"
110 SP$=" "
200 FORI=0TO6:READ A$:FORJ=1TO8:NM$(I*8+J)=MID$(A$,J*3-2,3):NEXT:NEXT
210 DATA "ADCANDASLBCCBCSBEQBITBMI"
220 DATA "BNEBPLBRKBVCBVSCLCCLDCLI"
230 DATA "CLVCMPCPXCPYDECDEXDEYEOR"
240 DATA "INCINXINYJMPJSRLDALDXLDY"
250 DATA "LSRNOPORAPHAPHPPLAPLPROL"
260 DATA "RORRTIRTSSBCSECSEDSEISTA"
270 DATA "STXSTYTAXTAYTSXTXATXSTYA"
280 FORI=0TO255:READ OP%(I):NEXT
310 DATA1105,3506,0,0,0,3503,303,0
320 DATA3705,3501,304,0,0,3502,302,0
330 DATA1011,3507,0,0,0,3508,308,0
340 DATA1405,3510,0,0,0,3509,309,0
350 DATA2902,206,0,0,703,203,4003,0
360 DATA3905,201,4004,0,702,202,4002,0
370 DATA811,207,0,0,0,208,4008,0
380 DATA4505,210,0,0,0,209,4009,0
390 DATA4205,2406,0,0,0,2403,3303,0
400 DATA3605,2401,3304,0,2802,2402,3302,0
410 DATA1211,2407,0,0,0,2408,3308,0
420 DATA1605,2410,0,0,0,2409,3309,0
430 DATA4305,106,0,0,0,103,4103,0
440 DATA3805,101,4104,0,2812,102,4102,0
450 DATA1311,107,0,0,0,108,4108,0
460 DATA4705,110,0,0,0,109,4109,0
470 DATA0,4806,0,0,5003,4803,4903,0
480 DATA2305,0,5405,0,5002,4802,4902,0
490 DATA411,4807,0,0,5008,4808,4913,0
500 DATA5605,4810,5505,0,0,4809,0,0
510 DATA3201,3006,3101,0,3203,3003,3103,0
520 DATA5205,3001,5105,0,3202,3002,3102,0
530 DATA511,3007,0,0,3208,3008,3113,0
540 DATA1705,3010,5305,0,3209,3009,3110,0
550 DATA2001,1806,0,0,2003,1803,2103,0
560 DATA2705,1801,2205,0,2002,1802,2102,0
570 DATA911,1807,0,0,0,1808,2108,0
580 DATA1505,1810,0,0,0,1809,2109,0
590 DATA1901,4406,0,0,1903,4403,2503,0
600 DATA2605,4401,3405,0,1902,4402,2502,0
610 DATA611,4407,0,0,0,4408,2508,0
620 DATA4605,4410,0,0,0,4409,2509,0
650 FORI=0TO13:READ NB(I):NEXT
660 DATA 1,2,3,2,1,1,2,2,2,3,3,2,3,2
680 PG=1:LL=1:LN=99
700 INPUT"START ADDRESS ";AD$:AD=0:IFLEFT$(AD$,1)<>"$"THENAD=VAL(AD$):GOTO709
702 AD$=MID$(AD$,2,6):IFAD$=""THEN709
703 N=ASC(AD$)-48:IFN>9THENN=N-7
704 IFN<0ORN>15THEN709
705 AD=AD*16+N:GOTO702
709 PRINT"[147]":HD$="ADDR CONTENTS SYMBOLIC ASCII DECIMAL":O$=HD$:GOSUB980
710 O$="":NN=AD:GOSUB20000:O$=O$+" "
712 GOSUB2000:B0=PEEK(1010):AM=OP%(B0)-INT(OP%(B0)/100)*100:B1=32:B2=32
715 NB=NB(AM):N=B0:GOSUB10000:O$=O$+" "
717 IFNB=1THEN:O$=O$+" ":GOTO740
720 GOSUB2000:B1=PEEK(1010):GOSUB9010:O$=O$+" ":IFNB=2THENO$=O$+" ":GOTO740
730 GOSUB2000:B2=PEEK(1010):N=B2:GOSUB10000
740 O$=O$+" "+NM$(INT(OP%(B0)/100))+" ":CM$=""
745 ONAM+1GOTO750,760,770,780,790,900,810,820,830,840,850,860,870,880
750 CM$="?DATA?":GOTO900
760 O$=O$+"#":GOSUB9000:GOTO900
770 GOSUB19000:GOTO900
780 GOSUB9000:GOTO900
790 O$=O$+"A":GOTO900
810 O$=O$+"(":GOSUB9000:O$=O$+",X)":GOTO900
820 O$=O$+"(":GOSUB9000:O$=O$+"),Y":GOTO900
830 GOSUB9000:O$=O$+",X":GOTO900
840 GOSUB19000:O$=O$+",X":GOTO900
850 GOSUB19000:O$=O$+",Y":GOTO900
860 NN=AD+B1:IFB1>127THENNN=NN-256
863 GOSUB19010:GOTO900
870 O$=O$+"(":GOSUB19000:O$=O$+")":GOTO900
880 GOSUB9000:O$=O$+",Y"
900 O$=O$+LEFT$(SP$,27-LEN(O$))+";"+CHR$(FNA(B0))+CHR$(FNA(B1))+CHR$(FNA(B2))
910 O$=O$+RIGHT$(SP$+CM$,6)
950 GETQQ$:IFQQ$="E"THENCLOSE1:CLOSE5:END
955 IFQQ$="A"THEN700
960 IFQQ$<>"S"THEN978
970 GETQQ$:IFQQ$="G"THEN978
972 IFQQ$="A"THEN700
975 IFQQ$="E"THENCLOSE1:CLOSE5:END
977 GOTO970
978 GOSUB980:GOTO710
980 PRINT O$
985 IFFO$="Y"THENPRINT#1,O$:GOSUB1000
986 IFPO$="Y"THENPRINT#5,O$
990 RETURN
1000 SZ=SZ+LEN(O$)+1
1010 IFSZ<192THENRETURN
1020 POKE59411,53:T=TI
1030 IFTI-T<6THEN1030
1040 POKE59411,61
1050 SZ=SZ-191
1060 RETURN
2000 POKE1012,AD-INT(AD/256)*256:POKE1013,AD/256
2010 SYS1011:AD=AD+1:RETURN
9000 O$=O$+"$"
9010 N=B1
10000 N=INT(N):N1=INT(N/16)
10010 O$=O$+MID$(H$,N1+1,1)+MID$(H$,N-16*N1+1,1)
10015 IFN>9THENCM$=STR$(N)
10020 RETURN
19000 NN=B1+256*B2
19010 O$=O$+"$"
20000 N=NN/256:GOSUB10000:N=NN-INT(NN/256)*256:GOSUB10000
20010 IFNN>9THENCM$=STR$(NN)
20020 RETURN
50000 OPEN1
50010 INPUT#1,A$:PRINTA$:GOTO50010